package com.example.second_home_work

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import android.widget.Button
import android.widget.TextView
import android.widget.Spinner
import android.widget.LinearLayout

class MainActivity : AppCompatActivity() {
    var count=0
    val expert=ProgramExpert()
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        val textView: TextView = findViewById(R.id.textView)
        val button: Button = findViewById(R.id.button)
        val button2: Button = findViewById((R.id.button2))
        val spinner: Spinner = findViewById(R.id.spinner)
        val linearLayout = findViewById<LinearLayout>(R.id.linearLayout)
        button.setOnClickListener {
            textView.text = expert.getLanguage(spinner.selectedItem.toString())
        }
        button2.setOnClickListener {
            val textView = TextView(this).apply {
                count++
                text = "New TextView $count!"
                textSize = 25f
            }
            linearLayout.addView(textView)


        }
    }
}